package in.falkeninc.umt_v0_9_8_1;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import android.os.Bundle;
import android.content.Intent;
import android.content.res.Configuration;
import android.view.View;
import android.widget.Toast;

public class DetailsActivity extends BaseAlarmActivities {

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
	
		Toast.makeText(this, "DetailsActivity", Toast.LENGTH_SHORT).show();

		ActionBar actionBar;
		actionBar = getSupportActionBar();
		actionBar.hide();
		
		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
			// If the screen is now in landscape mode, we can show the
			// dialog in-line with the list so we don't need this activity.
			finish();
			return;
		}

		if (savedInstanceState == null) {
			// During initial setup, plug in the details fragment.

			// create fragment
			details = new DetailsFragment();

			// get and set the position input by user (i.e., "index")
			// which is the construction arguments for this fragment
			details.setArguments(getIntent().getExtras());

			getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
		}
	}

	/* 
	 * Inflate the menu; this adds items to the action bar if it is present.
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		getSupportMenuInflater().inflate(R.menu.main, menu);
		return true;
	}


   // broadcast a custom intent. 
   public void broadcastIntent(View v)
   {
      Intent intent = new Intent();
      intent.setAction("in.falkeninc.umt_v0_9_8_1.CUSTOM_INTENT_ADDALARM");
      sendBroadcast(intent);
   }
   
}

